Skip to content

feat: Anthropic distill support (llm.api=anthropic-messages)#399

Open
Coke1120 wants to merge 4 commits intoCortexReach:masterfrom
Coke1120:feat/anthropic-distill
Open

feat: Anthropic distill support (llm.api=anthropic-messages)#399
Coke1120 wants to merge 4 commits intoCortexReach:masterfrom
Coke1120:feat/anthropic-distill

Conversation

@Coke1120
Copy link
Copy Markdown

@Coke1120 Coke1120 commented Mar 29, 2026

Summary

  • Add createAnthropicApiKeyClient to src/llm-client.ts supporting Anthropic /v1/messages API via llm.api=anthropic-messages
  • Add llm.api and llm.anthropicVersion config fields to index.ts, cli.ts, and openclaw.plugin.json
  • Add examples/new-session-distill/ with a worker demonstrating Anthropic-based lesson extraction
  • Add test/llm-api-key-client.test.mjs and update plugin-manifest-regression to assert new schema fields
  • Document Anthropic config and Bitwarden secret refs in README.md

Merge order

Must merge #398 first. This PR imports resolveSecretValue from src/secret-resolver.ts which is introduced in #398. It will not compile standalone.

Test plan

  • node --test test/llm-api-key-client.test.mjs — verify Anthropic client key handling
  • node test/plugin-manifest-regression.mjs — verify manifest schema declares llm.api and llm.anthropicVersion
  • npm test — full test suite passes
  • Smoke-test distill via examples/new-session-distill/ with a real session (requires live Anthropic API key)

Split from #349.

🤖 Generated with Claude Code

@AliceLJY
Copy link
Copy Markdown
Collaborator

Anthropic client implementation looks good — endpoint normalization, content block parsing, and JSON repair all handled correctly.

This PR includes all changes from #398 (Bitwarden secret resolver) — stacked PRs. #398 needs to merge first, then this PR's diff will be just the Anthropic additions. Will review/approve once #398 lands.

Copy link
Copy Markdown
Collaborator

@AliceLJY AliceLJY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the Anthropic distill support! Two things to sort out before merging:

  1. Merge order dependency: This PR references resolveSecretValue from secret-resolver.ts, which is introduced in #398. If #398 hasn't merged yet, this PR won't compile standalone. Please confirm the intended merge order, or rebase on top of #398 once it's in.

  2. Test checklist: The PR body has several test items still unchecked (test/llm-api-key-client.test.mjs etc.). Could you confirm all tests are passing and update the checklist?

Once those are clear, happy to approve!

Coke1120 and others added 4 commits March 31, 2026 18:31
Add createAnthropicApiKeyClient to src/llm-client.ts supporting the
Anthropic /v1/messages API format via llm.api=anthropic-messages.
Add llm.api and llm.anthropicVersion config fields to index.ts, cli.ts,
and openclaw.plugin.json. Add examples/new-session-distill/ with a
worker demonstrating Anthropic-based lesson extraction. Add
test/llm-api-key-client.test.mjs and update plugin-manifest-regression
to assert the new schema fields.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
With async register() now awaited, selfImprovement defaults to enabled
and registers command:new before the sessionMemory assertion runs.
Explicitly disable it in the base test config to isolate the assertion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…fest test configs

Lost during rebase onto master. selfImprovement now defaults to enabled,
so these test configs need it explicitly disabled to isolate command:new assertions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Coke1120 Coke1120 force-pushed the feat/anthropic-distill branch from d44b00f to bcc1567 Compare March 31, 2026 10:33
@Coke1120 Coke1120 requested a review from AliceLJY March 31, 2026 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants